<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

include 'classes/db.php';

$dbase = db::getInstance();
$_SESSION['dbname'] = $dbase->getDnName();
$_SESSION['dburl'] = $dbase->getDbUrl();
$_SESSION['dbuser'] = $dbase->getDbUser();
$_SESSION['dbpsw'] = $dbase->getDbPassword();
$_SESSION['dbport'] = $dbase->getDbPort();

//定义全局mysql
$mysql = new mysqli($_SESSION['dburl'], $_SESSION['dbuser'], $_SESSION['dbpsw'], $_SESSION['dbname']);

function initConn() {
    $connection = mysqli_connect($_SESSION['dburl'], $_SESSION['dbuser'], $_SESSION['dbpsw'], $_SESSION['dbname']);
    return $connection;
}

function closeConn($conn) {
    mysqli_close($conn);
}

?>
